from splinter import Browser
import bs4
import time,io,sqlite3,datetime,math
browser = Browser("chrome")
#browser = Browser("chrome",headless=True)
url = "http://aiportal.unicom.local/modules/login/login.html"
browser.visit(url)
#time.sleep(1)
browser.fill("login","zhaoweiming")
browser.fill("password","Zhaowm$314")
#time.sleep(1)
browser.find_by_text("登录").click()
print("登录成功！")
browser.visit("http://10.249.217.120/uflow/unicomDM.jsp?check_login=4a&token_id=emhhb3dlaW1pbmc=")
print("打开需求统一管理平台！")
browser.find_by_text("综合查询").click()
#browser.find_by_text("导出").click()
browser.find_by_text("本省需求查询").click()
time.sleep(2)
#browser.find_by_name('domain').click()
#browser.find_by_text("B域").click()
#browser.find_by_name('xqlx').click()
#browser.find_by_text("省分自建").click()
#browser.find_by_name('status').click()
#browser.find_by_text("评估").click()
#browser.find_by_text("确认").click()
browser.find_by_id("advancedSearch_btn").click()
time.sleep(1)
html = browser.html
soup = bs4.BeautifulSoup(html,"html5lib")
time.sleep(1)
browser.find_by_text("RNX2019121800361").click()
time.sleep(1)
window = browser.windows[1]
window.is_current = True
#获取需求描述
xqms = soup.find_all("dl")[4].get_text()